<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>色卡库管理</title>
<script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
<script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/lan.js}"></script>
<link href="template/style/css/style.css" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript">
$(function() {
$('th[type="order"]').click(function() {
var order = $(this).attr('field') + '-' + $(this).attr('order');
$('#order').val(order);
$('input[name="search"]').click();
}).css({'cursor': 'pointer', 'color': '#36c'});
var order = $('#order').val().split('-');
var field = $('th[type="order"][field="' + order[0] + '"]');
if (order[1] == 'ASC') {
field.attr('order', 'DESC').text(field.text() + '↑');
} else {
field.attr('order', 'ASC').text(field.text() + '↓');
}
if (order[0] != 'arrival_date') {
$('th[type="order"][field="arrival_date"]').attr('order', 'DESC');
}});

</script>
</head>
<body>
<div class="sub-body">
	<div id="head">
		<div  id="search">
			<!-- {if $user.role neq USER_MERCHANT && !$color_status} -->
			<form action="index.php" method="get">
				<table cellspacing="0" cellpadding="0" class="search" width="90%">
					<tr>
						<th width="10%">{$lang.fabric_shop_name}：</th>
						<td><select select_input="select_input" name="fabric_shop_id" id="" class="input-3" val="">
								<option value="0">{$lang.sel_fabric_shop}</option>
								<!--{foreach from=$fabricshop_list item=fabric_shop}-->
								<option value="{$fabric_shop.fabric_shop_id}" {if $smarty.get.fabric_shop_id == $fabric_shop.fabric_shop_id} selected{/if}>{$fabric_shop.fabric_shop_name|escape}</option>
								<!--{/foreach}-->
							</select></td>
						<th>{$lang.item}：</th>
						<td><select select_input="select_input" name="item" class="input-3" val="">
							<option value=""></option>
							<!--{foreach from=$cl_item_list item=cl_item}-->
							<option {if $smarty.get.item == $cl_item.item} selected{/if} value="{$cl_item.item}" >{$cl_item.item|escape}</option>
							<!--{/foreach}-->
						</select></td>
						<th width="100">{$lang.price}：</th>
						<td width="200"><input type="text" id="order_sn" name="price1" class="input-6" value="{$smarty.get.price1}" />
							{$lang.to}
							<input type="text" id="order_sn" name="price2" class="input-6" value="{$smarty.get.price2}" /></td>
						<td {if $user.role neq USER_FACTORY} rowspan="6" {else} rowspan="5" {/if}><input type="hidden" name="app" value="colorcard" />
							<input type="hidden" name="act" value="index" />
							<input type="hidden" name="order" id="order" value="{if $smarty.get.order}{$smarty.get.order}{else}update_time-DESC{/if}" />
							<input type="submit" name="search" value="{$lang.search}" class="inquiry" /></td>
					</tr>
					<tr>
						<th>{$lang.color_char}：</th>
						<td colspan="5">
							<div id="fabric_assign">
							<!-- {foreach from=$color_char_list item=chars name=cl} -->
								<input name="color_char_id[]" type="checkbox" value="{$chars.cf_id}" {if $color_arr_id}{if in_array($chars.cf_id,$color_arr_id)}checked=true{/if}{/if} style="vertical-align: -5px;_vertical-align: -1px;margin-right: 5px;width: 20px" />&nbsp;{$chars.cf_characteristics}&nbsp;
							<!-- {/foreach} -->
						</div>
						</td>
					</tr>
					<tr>
						<th>{$lang.color_attr}：</th>
						<td colspan="5">
							<div id="color_assign">
							<!-- {foreach from=$color_attr_list item=attrs name=ca} -->
								<input name="color_attr_id[]" type="checkbox" value="{$attrs.cs_id}" {if $color_attr_id}{if in_array($attrs.cs_id,$color_attr_id)}checked=true{/if}{/if} style="vertical-align: -5px;_vertical-align: -1px;margin-right: 5px;width: 20px" />&nbsp;{$attrs.cs_name}&nbsp;
							<!-- {/foreach} -->
							</div>
						</td>
					</tr>
                   {if $user.role neq USER_FACTORY && $user.role!=USER_CLIENT}
                    <tr>
						<th>创建人：</th>
						<td colspan="5"><select select_input="select_input" name="user_id"  class="input-3" val="">
								<option value=""></option>
								<!--{foreach from=$cl_user_list item=users}-->
								<option {if $smarty.get.user_id == $users.user_id} selected{/if} value="{$users.user_id}" >{$users.user_name|escape}</option>
								<!--{/foreach}-->
							</select></td>
					</tr>
                    {/if}
				</table>
			</form>
			<!-- {/if} -->
		</div>
	</div>
	<!-- {if !$color_status} -->
	<!-- {if $user.role==USER_FACTORY || $user.role==USER_MANAGER || $user.role==USER_MERCHANDISER_ADMIN || $user.role==USER_CIVILIAN || $user.role==USER_MERCHANDISER || $user.role==USER_MERCHANT} -->
	<div class="Create">
		<!-- {if $user.role==USER_FACTORY || $user.role==USER_MANAGER || $user.role==USER_MERCHANDISER_ADMIN || $user.role==USER_CIVILIAN || $user.role==USER_MERCHANDISER} -->
		<input type="button" class="btn-2" value="创建布行/档口" onclick="create_merchant()"/>&nbsp;&nbsp;&nbsp;&nbsp;
		<!-- {/if} -->
		<input type="button" class="btn-2" value="创建新色卡" onclick="create_order()"/>
	</div>
	<!-- {/if} -->
	<!-- {/if} -->
	<div class="tab_info" id="order_list">
		<div class="tab-title-1"><span>{$lang.colorcard_list}</span></div>
		<table width="100%" cellspacing="0" cellpadding="0" class="tab-display" id="tab-color1">
			<tr>
				<th width="3%">{$lang.No}</th>
				<th width="11%" type="order" field="update_time" order="ASC">{$lang.update_time}</th>
				<th width="20%" type="order" field="fabric_shop_name" order="ASC">{$lang.fabric_shop_name}</th>
				<th width="11%" type="order" field="item" order="ASC">{$lang.item}</th>
				<th width="6%" type="order" field="price" order="ASC">{$lang.price}</th>
				<th width="6%">{$lang.width}</th>
				<th width="6%">{$lang.cc_image}</th>
				<!-- {if $user.role!=USER_CLIENT} -->
                <th width="6%">创建人</th>
                <th width="6%" type="order" field="color_status" order="ASC">状态</th>
				<!-- {/if} -->
				<th width="11%" nowrap="nowrap">{$lang.handle}</th>
			</tr>
			<!--{foreach from=$colorcard_list item=colorcard key=k name=o}-->
			<tr>
				<td>{$smarty.foreach.o.iteration}</td>
				<td>{$colorcard.update_time|date}</td>
				<td>{$colorcard.fabric_shop_name}</td>
				<td>{$colorcard.item}</td>
				<td>{$colorcard.price}</td>
				<td>{$colorcard.width}</td>
				<td><a href="{url app=colorcard&act=show&cc_id=$colorcard.cc_id}" target="_blank"><!-- {if $colorcard.default_image} --><img src="{$colorcard.default_image}" width="80" style="border:none;" title="{$lang.view}"/><!-- {else} -->{$lang.view}<!-- {/if} --></a></td>
                <!-- {if $user.role!=USER_CLIENT} -->
                <td>{$colorcard.user_name}</td>
                <td><!-- {if $colorcard.color_status} -->{$lang.yes_examine}<!-- {else} -->{$lang.no_examine}<!-- {/if} --></td>
				<!-- {/if} -->
				<td><!-- {if $colorcard.edit && $colorcard.color_status!=1} --> 
					<a href="{$site_url}/index.php?app=colorcard&act=edit&cc_id={$colorcard.cc_id}">{$lang.edit}</a> / <a href="javascript:if(confirm('确认删除此色卡吗?')==true){location.href='{$site_url}/index.php?app=colorcard&act=del&cc_id={$colorcard.cc_id}';};">{$lang.delete}</a> 
					<!-- {else} --> 
					<!-- {if $user.role eq USER_CIVILIAN || $user.role eq USER_MANAGER} -->
					<a href="javascript:if(confirm('确认要重置此色卡状态吗?')==true){location.href='{$site_url}/index.php?app=colorcard&act=reset_color&cc_id={$colorcard.cc_id}';};">重置</a> /
					<!-- {/if} -->
					<a href="{$site_url}/index.php?app=colorcard&act=edit&cc_id={$colorcard.cc_id}">{$lang.view}</a>
					<!-- {/if} -->
					<!-- {if $user.role eq USER_MERCHANDISER || $user.role eq USER_MERCHANDISER_ADMIN} -->
					/ <a href="{$site_url}/index.php?app=colorcard&act=recomm_color&cc_id={$colorcard.cc_id}">推荐</a>
					<!-- {/if} -->
				</td>
			</tr>
			<!--{/foreach}-->
		</table>
		<div class="page"> {include file=page.html}</div>
	</div>
	<script language="JavaScript">
function create_order(){
location.href='index.php?app=colorcard&act=add';
return;
}
function create_merchant(){
	location.href='index.php?app=merchant&act=add';
	return;
}
function DoEmpty(params)
{
if (confirm("确定要删除吗？"))
window.location = "{$site_url}/index.php?app=colorcard&act=drop&cc_id=" + params ;
}
</script>
	<div id="order_info"> </div>
</div>
<script language="javascript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
</body>
</html>
